#ifndef __CILENT__
#define __CILENT__
#include "myheader.h"
// 定义宏
typedef enum {
    CD = 1,
    PWD,
    LS,
    MKDIR,
    RMDIR,
    PUTS,
    GETS,
    REMOVE,
    QUIT,  // 添加QUIT命令
    ERROR_COMMAND,
    LOGIN,
    REGISTER,        // 新增注册命令
    LOGIN_SUCCESS,   // 登录成功响应
    LOGIN_FAIL,      // 登录失败响应
    REGISTER_SUCCESS,// 注册成功响应
    REGISTER_FAIL    // 注册失败响应
} CommandType;

typedef struct {
    CommandType commend;  // 改为CommandType
    int length;
    char data[1024];
} Train;

bool is_valid_command(CommandType cmd, const char* param, int num_params);
int parse_command(char* input, Train* ptrain);
int getsCommand(int sockfd);
int putsCommand(int sockfd,char*md5,char*filename);
int auth_action(int sockfd, CommandType action_type, const char* username, const char* password);
int recvn(int sockfd,void* buf,ssize_t length);
int sendn(int sockfd,void* buf,ssize_t length);
#endif 
